<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.DriverManager" %><%--
  Created by IntelliJ IDEA.
  User: JAVA
  Date: 2018/5/7
  Time: 20:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>更新信息</title>
</head>
<body>
<h1>信息更新成功！</h1>
<a href='userList.jsp'>返回首页</a>
<%
    request.setCharacterEncoding("UTF-8");
//1. 得到用户的输入信息
    String id=request.getParameter("id");
String time = request.getParameter("time");
String time1 = request.getParameter("time1");
String tel = request.getParameter("tel");

//2. 3+1 写到数据库
// 3 + 1
Connection connection = null;
Statement statement = null;

// 221
String sql = "update sctu_on_time set time1='"+time+"',time2='"+time1+"', tel='"+tel+"' where id = " +id+"";


    Class.forName("com.mysql.jdbc.Driver");
    connection= DriverManager.getConnection(
            "jdbc:mysql://localhost:3306/on_time?serverTimezone=UTC",
            "root",
            "123456"//大家的密码是123456
    );
    statement = connection.createStatement();


   statement.executeUpdate(sql);

%>
</body>
</html>
